<table>
	<thead>
        <tr>
            <th>Mã phiếu</th>
            <th>Ngày</th>
            <th>Lý do</th>
            <th>Số tiền</th>
        </tr>
    </thead>
    <tbody>
    	<tr>
        	<td><strong>Phiếu thu</strong></td>
        </tr>
        <?php $sumthu = 0;?>
        <?php foreach($data_phieuthu as $item){ ?>
        <tr>
        	<td><?php echo $item['sophieu']?></td>
            <td><?php echo $this->date->formatMySQLDate($item['ngaylap'])?></td>
            <td><?php echo $item['lydo']?></td>
            <td class="number"><?php echo $this->string->numberFormate($item['quidoi'])?></td>
        </tr>
        	<?php $sumthu +=$item['quidoi']?>
        <?php } ?>
        <tr>
        	<td></td>
            <td></td>
            <td align="right"><strong>Tổng thu</strong></td>
            <td class="number"><?php echo $this->string->numberFormate($sumthu)?></td>
        </tr>
        <tr>
        	<td><strong>Phiếu chi</strong></td>
        </tr>
        <?php $sumchi = 0;?>
        <?php foreach($data_phieuchi as $item){ ?>
        <tr>
        	<td><?php echo $item['sophieu']?></td>
            <td><?php echo $this->date->formatMySQLDate($item['ngaylap'])?></td>
            <td><?php echo $item['lydo']?></td>
            <td class="number"><?php echo $this->string->numberFormate($item['quidoi'])?></td>
        </tr>
        	<?php $sumchi += $item['quidoi']?>
        <?php } ?>
        <tr>
        	<td></td>
            <td></td>
            <td align="right"><strong>Tổng chi</strong></td>
            <td class="number"><?php echo $this->string->numberFormate($sumchi)?></td>
        </tr>
    </tbody>
</table>
<p>
	<label>Số dư trong kỳ:</label>
    <?php echo $this->string->numberFormate($sumthu - $sumchi)?>
</p>
	